package com.gosophia.resource.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.resourcePermission.dto.ResourcePermissionDTO;
import com.gosophia.resourcePermission.dto.RuleDTO;
import com.gosophia.resourcePermission.ws.ResourcePermissionWebService;
import com.gosophia.util.RequestResultUtil;

/**
 * 初始化添加规则页面
 * @author zhao_yanfang
 *
 */
@Controller("initAddRuleAction")
@Scope("prototype")
public class InitAddRuleAction extends BaseSupportAction{

	private long resourceId; 
	private ResourcePermissionDTO resourcePermissionDTO;
	private RuleDTO ruleDTO=new RuleDTO();
	private static final Log logger = LogFactory
	.getLog(ShowResourcePageAction.class);
	@Autowired
	private ResourcePermissionWebService resourcePermissionWebService;
	public String _execute() throws Exception {
		logger.info("初始化新增规则页面,资源编号为:"+resourceId);
		resourcePermissionDTO=resourcePermissionWebService.findResourceById(resourceId);
		ruleDTO.setResourceName(resourcePermissionDTO.getResourceName());
		ruleDTO.setResourceId(resourcePermissionDTO.getResourceId());
		return SUCCESS;
	}
	public long getResourceId() {
		return resourceId;
	}
	public void setResourceId(long resourceId) {
		this.resourceId = resourceId;
	}
	public ResourcePermissionDTO getResourcePermissionDTO() {
		return resourcePermissionDTO;
	}
	public void setResourcePermissionDTO(ResourcePermissionDTO resourcePermissionDTO) {
		this.resourcePermissionDTO = resourcePermissionDTO;
	}
	public RuleDTO getRuleDTO() {
		return ruleDTO;
	}
	public void setRuleDTO(RuleDTO ruleDTO) {
		this.ruleDTO = ruleDTO;
	}
	
	
	
}
